Select Default Language Display:

  • C++
  • Python
  • JavaScript
  • Java
  • All Languages

Signature Class

A Signature is an abstract base class providing methods to work with the signature information in an interest or data packet. You must create an object of a subclass, for example Sha256WithRsaSignature.

[C++]:
#include <ndn-cpp/signature.hpp>
Namespace: ndn
[Python]:Module: pyndn
[Java]:Package: net.named_data.jndn

Signature.clone Method

Return a pointer to a new Signature which is a copy of this signature. This is abstract, the subclass must implement it.

[C++]:
virtual ptr_lib::shared_ptr<Signature> clone() const = 0;
[Python]:
# Returns a subclass of Signature
def clone(self)
[JavaScript]:
// Returns a subclass of Signature
Signature.prototype.clone = function()
[Java]:
public abstract Object clone()
Returns:

An new object of a subclass of Signature which is a clone of this object.

DigestSha256Signature Class

A DigestSha256Signature extends Signature and holds the signature bits (which are only the SHA256 digest) and an empty SignatureInfo for a data packet or signed interest.

[C++]:
#include <ndn-cpp/digest-sha256-signature.hpp>
Namespace: ndn
[Python]:Module: pyndn
[Java]:Package: net.named_data.jndn

DigestSha256Signature Constructor

Create a new DigestSha256Signature object.

[C++]:
DigestSha256Signature();
[Python]:
def __init__(self)
[JavaScript]:
var DigestSha256Signature = function DigestSha256Signature()
[Java]:
public DigestSha256Signature()

DigestSha256Signature Get Methods

DigestSha256Signature.getSignature Method

Get the signature bytes (which are only the digest).

[C++]:
const Blob& getSignature() const;
[Python]:
# Returns Blob
def getSignature(self)
[JavaScript]:
// Returns Blob
DigestSha256Signature.prototype.getSignature = function()
[Java]:
public final Blob getSignature()
Returns:

The signature bytes. If not specified, the value isNull().

DigestSha256Signature Set Methods

DigestSha256Signature.setSignature Method

Set the signature bytes (which are only the digest) to the given value.

Note

Normally you do not set the signature bytes directly, but instead use KeyChain.signWithSha256.

[C++]:
void setSignature(
    const Blob& signature
);
[Python]:
def setSignature(self,
    signature  # Blob
)
[JavaScript]:
DigestSha256Signature.prototype.setSignature = function(
    signature  // Blob
)
[Java]:
public final void setSignature(
    Blob signature
)
Parameters:
  • signature

    A Blob with the signature bytes.

DigestSha256Signature.clone Method

Return a pointer to a new DigestSha256Signature which is a copy of this signature.

[C++]:
virtual ptr_lib::shared_ptr<Signature> clone() const;
[Python]:
# Returns DigestSha256Signature
def clone(self)
[JavaScript]:
// Returns DigestSha256Signature
DigestSha256Signature.prototype.clone = function()
[Java]:
public Object clone()
Returns:

A new DigestSha256Signature object.

GenericSignature Class

A GenericSignature extends Signature and holds the encoding bytes of the SignatureInfo so that the application can process experimental signature types. When decoding a packet, if the type of SignatureInfo is not recognized, the library creates a GenericSignature.

[C++]:
#include <ndn-cpp/generic-signature.hpp>
Namespace: ndn
[Python]:Module: pyndn
[Java]:Package: net.named_data.jndn

GenericSignature Constructor

Create a new GenericSignature object.

[C++]:
GenericSignature();
[Python]:
def __init__(self)
[JavaScript]:
var GenericSignature = function GenericSignature()
[Java]:
public GenericSignature()

GenericSignature Get Methods

GenericSignature.getSignature Method

Get the signature bytes.

[C++]:
const Blob& getSignature() const;
[Python]:
# Returns Blob
def getSignature(self)
[JavaScript]:
// Returns Blob
GenericSignature.prototype.getSignature = function()
[Java]:
public final Blob getSignature()
Returns:

The signature bytes. If not specified, the value isNull().

GenericSignature.getSignatureInfoEncoding Method

Get the bytes of the entire signature info encoding (including the type code).

[C++]:
const Blob& getSignatureInfoEncoding() const;
[Python]:
# Returns Blob
def getSignatureInfoEncoding(self)
[JavaScript]:
// Returns Blob
GenericSignature.prototype.getSignatureInfoEncoding = function()
[Java]:
public final Blob getSignatureInfoEncoding()
Returns:

The encoding bytes. If not specified, the value isNull().

GenericSignature.getTypeCode Method

Get the type code of the signature type. When wire decode calls setSignatureInfoEncoding, it sets the type code. Note that the type code is ignored during wire encode, which simply uses getSignatureInfoEncoding() where the encoding already has the type code.

[C++]:
int getTypeCode() const;
[Python]:
# Returns int
def getTypeCode(self)
[JavaScript]:
// Returns number
GenericSignature.prototype.getTypeCode = function()
[Java]:
public final int getTypeCode()
Returns:

The type code. If not specified, return -1 (C++ and Java) or None (Python) or undefined (JavaScript).

GenericSignature Set Methods

GenericSignature.setSignature Method

Set the signature bytes to the given value.

[C++]:
void setSignature(
    const Blob& signature
);
[Python]:
def setSignature(self,
    signature  # Blob
)
[JavaScript]:
GenericSignature.prototype.setSignature = function(
    signature  // Blob
)
[Java]:
public final void setSignature(
    Blob signature
)
Parameters:
  • signature

    A Blob with the signature bytes.

GenericSignature.setSignatureInfoEncoding Method

Get the type code of the signature type. When wire decode calls setSignatureInfoEncoding, it sets the type code. Note that the type code is ignored during wire encode, which simply uses getSignatureInfoEncoding() where the encoding already has the type code.

[C++]:
void setSignatureInfoEncoding(
    const Blob& signatureInfoEncoding
    [, int typeCode]
);
[Python]:
def setSignatureInfoEncoding(self,
    signatureInfoEncoding  # Blob
    [, typeCode]           # int
)
[JavaScript]:
GenericSignature.prototype.setSignatureInfoEncoding = function(
    signatureInfoEncoding  // Blob
    [, typeCode]           // number
)
[Java]:
public final void setSignatureInfoEncoding(
    Blob signatureInfoEncoding
    [, int typeCode]
)
Parameters:
  • signatureInfoEncoding

    A Blob with the encoding bytes.

  • typeCode

    The type code of the signature type. If not known, set to -1 (C++ and Java) or None (Python) or undefined (JavaScript). (When a GenericSignature is created by wire decoding, it sets the typeCode.)

GenericSignature.clone Method

Return a pointer to a new GenericSignature which is a copy of this signature.

[C++]:
virtual ptr_lib::shared_ptr<Signature> clone() const;
[Python]:
# Returns GenericSignature
def clone(self)
[JavaScript]:
// Returns GenericSignature
GenericSignature.prototype.clone = function()
[Java]:
public Object clone()
Returns:

A new GenericSignature object.

Sha256WithRsaSignature Class

A Sha256WithRsaSignature extends Signature and holds the signature bits and other info representing a SHA256-with-RSA signature in an interest or data packet.

[C++]:
#include <ndn-cpp/sha256-with-rsa-signature.hpp>
Namespace: ndn
[Python]:Module: pyndn
[Java]:Package: net.named_data.jndn

Sha256WithRsaSignature Constructor

Create a new Sha256WithRsaSignature object.

[C++]:
Sha256WithRsaSignature();
[Python]:
def __init__(self)
[JavaScript]:
var Sha256WithRsaSignature = function Sha256WithRsaSignature()
[Java]:
public Sha256WithRsaSignature()

Sha256WithRsaSignature Get Methods

Sha256WithRsaSignature.getKeyLocator Method

Get the signature KeyLocator object.

[C++]:
KeyLocator& getKeyLocator();

const KeyLocator& getKeyLocator() const;
[Python]:
# Returns KeyLocator
def getKeyLocator(self)
[JavaScript]:
// Returns KeyLocator
Sha256WithRsaSignature.prototype.getKeyLocator = function()
[Java]:
public final KeyLocator getKeyLocator()
Returns:

The KeyLocator object. If not specified, the key locator getType() is not specified.

Sha256WithRsaSignature.getSignature Method

Get the signature bytes.

[C++]:
const Blob& getSignature() const;
[Python]:
# Returns Blob
def getSignature(self)
[JavaScript]:
// Returns Blob
Sha256WithRsaSignature.prototype.getSignature = function()
[Java]:
public final Blob getSignature()
Returns:

The signature bytes. If not specified, the value isNull().

Sha256WithRsaSignature Set Methods

Sha256WithRsaSignature.setKeyLocator Method

Set this signature object to use a copy of the given KeyLocator object.

Note

You can also call getKeyLocator and change the key locator directly.

[C++]:
void setKeyLocator(
    const KeyLocator& keyLocator
);
[Python]:
def setKeyLocator(self,
    keyLocator  # KeyLocator
)
[JavaScript]:
Sha256WithRsaSignature.prototype.setKeyLocator = function(
    keyLocator  // KeyLocator
)
[Java]:
public final void setKeyLocator(
    KeyLocator keyLocator
)
Parameters:
  • keyLocator

    The KeyLocator object. This makes a copy of the object. If no key locator is specified, set to a new default KeyLocator(), or to a KeyLocator with an unspecified type.

Sha256WithRsaSignature.setSignature Method

Set the signature bytes to the given value.

Note

Normally you do not set the signature bytes directly, but instead use KeyChain.sign.

[C++]:
void setSignature(
    const Blob& signature
);
[Python]:
def setSignature(self,
    signature  # Blob
)
[JavaScript]:
Sha256WithRsaSignature.prototype.setSignature = function(
    signature  // Blob
)
[Java]:
public final void setSignature(
    Blob signature
)
Parameters:
  • signature

    A Blob with the signature bytes.

Sha256WithRsaSignature.clone Method

Return a pointer to a new Sha256WithRsaSignature which is a copy of this signature.

[C++]:
virtual ptr_lib::shared_ptr<Signature> clone() const;
[Python]:
# Returns Sha256WithRsaSignature
def clone(self)
[JavaScript]:
// Returns Sha256WithRsaSignature
Sha256WithRsaSignature.prototype.clone = function()
[Java]:
public Object clone()
Returns:

A new Sha256WithRsaSignature object.

Sha256WithEcdsaSignature Class

A Sha256WithEcdsaSignature extends Signature and holds the signature bits and other info representing a SHA256-with-ECDSA signature in an interest or data packet.

[C++]:
#include <ndn-cpp/sha256-with-ecdsa-signature.hpp>
Namespace: ndn
[Python]:Module: pyndn
[Java]:Package: net.named_data.jndn

Sha256WithEcdsaSignature Constructor

Create a new Sha256WithEcdsaSignature object.

[C++]:
Sha256WithEcdsaSignature();
[Python]:
def __init__(self)
[Java]:
public Sha256WithEcdsaSignature()

Sha256WithEcdsaSignature Get Methods

Sha256WithEcdsaSignature.getKeyLocator Method

Get the signature KeyLocator object.

[C++]:
KeyLocator& getKeyLocator();

const KeyLocator& getKeyLocator() const;
[Python]:
# Returns KeyLocator
def getKeyLocator(self)
[Java]:
public final KeyLocator getKeyLocator()
Returns:

The KeyLocator object. If not specified, the key locator getType() is not specified.

Sha256WithEcdsaSignature.getSignature Method

Get the signature bytes.

[C++]:
const Blob& getSignature() const;
[Python]:
# Returns Blob
def getSignature(self)
[Java]:
public final Blob getSignature()
Returns:

The signature bytes. If not specified, the value isNull().

Sha256WithEcdsaSignature Set Methods

Sha256WithEcdsaSignature.setKeyLocator Method

Set this signature object to use a copy of the given KeyLocator object.

Note

You can also call getKeyLocator and change the key locator directly.

[C++]:
void setKeyLocator(
    const KeyLocator& keyLocator
);
[Python]:
def setKeyLocator(self,
    keyLocator  # KeyLocator
)
[Java]:
public final void setKeyLocator(
    KeyLocator keyLocator
)
Parameters:
  • keyLocator

    The KeyLocator object. This makes a copy of the object. If no key locator is specified, set to a new default KeyLocator(), or to a KeyLocator with an unspecified type.

Sha256WithEcdsaSignature.setSignature Method

Set the signature bytes to the given value.

Note

Normally you do not set the signature bytes directly, but instead use KeyChain.sign.

[C++]:
void setSignature(
    const Blob& signature
);
[Python]:
def setSignature(self,
    signature  # Blob
)
[Java]:
public final void setSignature(
    Blob signature
)
Parameters:
  • signature

    A Blob with the signature bytes.

Sha256WithEcdsaSignature.clone Method

Return a pointer to a new Sha256WithEcdsaSignature which is a copy of this signature.

[C++]:
virtual ptr_lib::shared_ptr<Signature> clone() const;
[Python]:
# Returns Sha256WithEcdsaSignature
def clone(self)
[Java]:
public Object clone()
Returns:

A new Sha256WithEcdsaSignature object.