com.sap.security.api.ssf

Interface ISsfData

All Known Implementing Classes:
SsfDataPKCS7, SsfDataSMIME, SsfDataXML

public interface ISsfData

Interface for representing data to be digitally signed, verified, encrypted or decrypted


Field Summary
static String ALG_AES128_CBC
          Name of symmetric encryption algorithm AES (128 bit) in CBC mode.
static String ALG_AES192_CBC
          Name of symmetric encryption algorithm AES (192 bit) in CBC mode.
static String ALG_AES256_CBC
          Name of symmetric encryption algorithm AES (256 bit) in CBC mode.
static String ALG_DES_EDE3_CBC
          Name of symmetric encryption algorithm triple DES in CBC mode.
static String ALG_MD5
          Name of message digest algorithm MD5 (not recommended).
static String ALG_RC2_40_CBC
          Name of symmetric encryption algorithm RC2 (40 bit) in CBC mode.
static String ALG_RC2_CBC
          Name of symmetric encryption algorithm RC2 (128 bit) in CBC mode.
static String ALG_SHA
          Name of message digest algorithm SHA-1.
static String ALG_SHA256
          Name of message digest algorithm SHA-256.
static String ALG_SHA512
          Name of message digest algorithm SHA-512.
static int INC_CERT_CHAIN
          Include certificate chain without root when creating a digital signature (default).
static int INC_CERT_CHAIN_ROOT
          Include certificate chain with root when creating a digital signature.
static int INC_CERT_NONE
          Do not include any certificates when creating a digital signature.
static int INC_CERT_OWN
          Include own certificate when creating a digital signature.
 
Method Summary
 boolean decrypt(ISsfProfile profile)
          Decrypts the given data.
 boolean encrypt(SsfSigRcpList rcpList, ISsfPab pab)
          Encrypts the given data.
 boolean encrypt(SsfSigRcpList rcpList, ISsfPab pab, String symAlg)
          Encrypts the given data.
 boolean sign(ISsfProfile profile)
          Creates a digital siganture of the given data.
 boolean sign(ISsfProfile profile, String mdAlg, int incCerts, boolean detached)
          Creates a digital siganture of the given data.
 boolean verify(ISsfPab pab, SsfSigRcpList sigList)
          Verifies a digital signature of the given data.
 boolean verify(ISsfPab pab, SsfSigRcpList sigList, ISsfData input, X509Certificate cert)
          Verifies a digital signature of the given data.
 boolean writeTo(OutputStream out)
          Writes the changed data to an output stream
 

Field Detail

ALG_SHA

static final String ALG_SHA
Name of message digest algorithm SHA-1.

See Also:
Constant Field Values

ALG_SHA256

static final String ALG_SHA256
Name of message digest algorithm SHA-256.

See Also:
Constant Field Values

ALG_SHA512

static final String ALG_SHA512
Name of message digest algorithm SHA-512.

See Also:
Constant Field Values

ALG_MD5

static final String ALG_MD5
Name of message digest algorithm MD5 (not recommended).

See Also:
Constant Field Values

ALG_AES128_CBC

static final String ALG_AES128_CBC
Name of symmetric encryption algorithm AES (128 bit) in CBC mode.

See Also:
Constant Field Values

ALG_AES192_CBC

static final String ALG_AES192_CBC
Name of symmetric encryption algorithm AES (192 bit) in CBC mode.

See Also:
Constant Field Values

ALG_AES256_CBC

static final String ALG_AES256_CBC
Name of symmetric encryption algorithm AES (256 bit) in CBC mode.

See Also:
Constant Field Values

ALG_DES_EDE3_CBC

static final String ALG_DES_EDE3_CBC
Name of symmetric encryption algorithm triple DES in CBC mode.

See Also:
Constant Field Values

ALG_RC2_40_CBC

static final String ALG_RC2_40_CBC
Name of symmetric encryption algorithm RC2 (40 bit) in CBC mode.

See Also:
Constant Field Values

ALG_RC2_CBC

static final String ALG_RC2_CBC
Name of symmetric encryption algorithm RC2 (128 bit) in CBC mode.

See Also:
Constant Field Values

INC_CERT_NONE

static final int INC_CERT_NONE
Do not include any certificates when creating a digital signature.

See Also:
Constant Field Values

INC_CERT_OWN

static final int INC_CERT_OWN
Include own certificate when creating a digital signature.

See Also:
Constant Field Values

INC_CERT_CHAIN

static final int INC_CERT_CHAIN
Include certificate chain without root when creating a digital signature (default).

See Also:
Constant Field Values

INC_CERT_CHAIN_ROOT

static final int INC_CERT_CHAIN_ROOT
Include certificate chain with root when creating a digital signature.

See Also:
Constant Field Values
Method Detail

sign

boolean sign(ISsfProfile profile)
             throws SsfInvalidKeyException
Creates a digital siganture of the given data.

Parameters:
profile - containing the secret key of the signer
Returns:
sign(profile, ALG_SHA, INC_CERT_CHAIN, false)
Throws:
SsfInvalidKeyException - if invalid key is used

sign

boolean sign(ISsfProfile profile,
             String mdAlg,
             int incCerts,
             boolean detached)
             throws SsfInvalidKeyException,
                    SsfInvalidAlgException
Creates a digital siganture of the given data.

Parameters:
profile - containing the secret key of the signer
mdAlg - message digest algorithm used to hash the data
incCerts - determine if certificates should be included
detached - if true do not include data into signature
Returns:
true if signature could be created
Throws:
SsfInvalidKeyException - if invalid key is used
SsfInvalidAlgException - if invalid algorithm is used

verify

boolean verify(ISsfPab pab,
               SsfSigRcpList sigList)
               throws SsfInvalidDataException
Verifies a digital signature of the given data.

Parameters:
pab - personal address book containing trusted certificates (if null, all certificates are considered as trusted, i.e. the signer certificates must be validated by the caller)
sigList - list of signer information
Returns:
verify(pab, null, signer)
Throws:
SsfInvalidDataException - if given data is not digitally signed

verify

boolean verify(ISsfPab pab,
               SsfSigRcpList sigList,
               ISsfData input,
               X509Certificate cert)
               throws SsfInvalidDataException
Verifies a digital signature of the given data.

Parameters:
pab - personal address book containing trusted certificates (if null, all certificates are considered as trusted, i.e. the signer certificates must be validated by the caller)
sigList - list of signer information
input - unsigned data (provide only in case of detached signature, in case of attached signature pass null)
cert - certificate to be used for verification (if null, use certificate included in signed data)
Returns:
true if (at least one) signature could be verified
Throws:
SsfInvalidDataException - if given data is not digitally signed

encrypt

boolean encrypt(SsfSigRcpList rcpList,
                ISsfPab pab)
                throws SsfInvalidKeyException
Encrypts the given data.

Parameters:
rcpList - list of recipients of encrypted data
pab - personal address book containing trusted certificates
Returns:
encrypt(rcp, pab, ALG_AES128_CBC)
Throws:
SsfInvalidKeyException - if invalid key is used

encrypt

boolean encrypt(SsfSigRcpList rcpList,
                ISsfPab pab,
                String symAlg)
                throws SsfInvalidKeyException,
                       SsfInvalidAlgException
Encrypts the given data.

Parameters:
rcpList - list of recipients of encrypted data
pab - personal address book containing the certificate of the recipient (if null, all certificates are considered as trusted)
symAlg - name of symmetric encryption algorithm
Returns:
true if data could be encrypted for all recipients
Throws:
SsfInvalidKeyException - if invalid key is used
SsfInvalidAlgException - if invalid algorithm is used

decrypt

boolean decrypt(ISsfProfile profile)
                throws SsfInvalidKeyException,
                       SsfInvalidDataException
Decrypts the given data.

Parameters:
profile - containing the secret key of the recipient
Returns:
true if encrypted data could be decrypted
Throws:
SsfInvalidKeyException - if invalid key is used
SsfInvalidDataException - if given data is not encrypted

writeTo

boolean writeTo(OutputStream out)
                throws IOException
Writes the changed data to an output stream

Parameters:
out - output stream
Returns:
true if data could be written
Throws:
IOException - if an I/O error occurs
Access Rights

This class can be accessed from:


SC DC
[sap.com] ENGINEAPI [sap.com] security.class
[sap.com] ENGFACADE [sap.com] tc/bl/security/lib
[sap.com] CORE-TOOLS [sap.com] com.sap.engine.client.lib


Copyright 2010 SAP AG Complete Copyright Notice