|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.sap.security.core.server.ssf.SsfDataXML
Class for representing data to be digitally signed, verified, encrypted or decrypted, using XML Signature/Encryption syntax.
| Fields inherited from interface com.sap.security.api.ssf.ISsfData |
ALG_AES128_CBC, ALG_DES_EDE3_CBC, ALG_MD5, ALG_RC2_40_CBC, ALG_RC2_CBC, ALG_SHA, INC_CERT_CHAIN, INC_CERT_CHAIN_ROOT, INC_CERT_NONE, INC_CERT_OWN |
| Constructor Summary | |
SsfDataXML(org.w3c.dom.Element el)
Define XML element to be signed, verified, encrypted or decrypted |
|
SsfDataXML(java.io.InputStream in)
Read XML data to be signed, verified, encrypted or decrypted |
|
| Method Summary | |
boolean |
decrypt(org.w3c.dom.Element encData,
ISsfProfile profile,
java.security.Key key)
Decrypts an encrypted data element. |
boolean |
decrypt(ISsfProfile profile)
Decrypts the given data. |
static boolean |
decryptData(org.w3c.dom.Element encData,
java.security.Key symKey,
java.lang.String symAlgURI)
Decrypts and restores an encrypted data element. |
static java.security.Key |
decryptKey(org.w3c.dom.Element encKey,
ISsfProfile prof,
java.lang.String symAlgURI,
java.util.ArrayList dataRefList)
Decrypts an encrypted symmetric key |
boolean |
encrypt(org.w3c.dom.Element keyParent,
SsfRefXMLList refList,
SsfSigRcpList rcpList,
ISsfPab pab,
java.lang.String symAlgURI)
Encrypts the given data. |
boolean |
encrypt(SsfSigRcpList rcpList,
ISsfPab pab)
Encrypts the given data. |
boolean |
encrypt(SsfSigRcpList rcpList,
ISsfPab pab,
java.lang.String symAlg)
Encrypts the given data. |
static org.w3c.dom.Element |
encryptData(org.w3c.dom.Element encHome,
boolean contentOnly,
java.security.Key symKey,
java.lang.String symAlgURI,
java.lang.String id)
Encrypts an element and replaces the element or its content by an encrypted data element |
static boolean |
encryptKey(org.w3c.dom.Element keyParent,
java.security.Key key,
java.security.cert.X509Certificate cert,
java.lang.String id,
SsfRefXMLList refList)
Create and insert an encrypted key element |
java.lang.String |
getCanonicalizationAlgorithm()
Get algorithm which is used for canonicalization of SignedInfo element |
org.w3c.dom.Element |
getDataXML()
Get XML element which results from previous operations |
boolean |
setCanonicalizationAlgorithm(java.lang.String canonAlgURI)
Set algorithm which is used for canonicalization of SignedInfo element (default. |
boolean |
sign(org.w3c.dom.Element sigHome,
SsfRefXMLList refList,
ISsfProfile profile,
int incCerts,
boolean detached)
Deprecated. Use sign(Element sigHome, SsfRefXMLList refList, ISsfProfile profile,
int incCerts, boolean detached, boolean incKeyName) instead |
boolean |
sign(org.w3c.dom.Element sigHome,
SsfRefXMLList refList,
ISsfProfile profile,
int incCerts,
boolean detached,
boolean incKeyName)
Creates a digital signature of the given data |
boolean |
sign(ISsfProfile profile)
Creates a digital siganture of the given data. |
boolean |
sign(ISsfProfile profile,
java.lang.String mdAlg,
int incCerts,
boolean detached)
Creates a digital siganture of the given data. |
boolean |
sign(SsfRefXMLList refList,
ISsfProfile profile,
int incCerts,
boolean detached)
Deprecated. Use sign(Element sigHome, SsfRefXMLList refList, ISsfProfile profile,
int incCerts, boolean detached, boolean incKeyName) instead |
static boolean |
signData(org.w3c.dom.Element sigHome,
SsfRefXMLList refList,
ISsfProfile profile,
int incCerts,
boolean incKeyName,
java.lang.String canonAlgURI)
Creates a signed data element at a given home element |
java.lang.String |
toString()
Get parsed XML data (might be large!) |
boolean |
verify(org.w3c.dom.Element sigHome,
ISsfPab pab,
SsfSigRcpList sigList,
SsfRefXMLList refList,
java.security.cert.X509Certificate cert)
Verifies a digital signature of the given data and restores the original data |
boolean |
verify(ISsfPab pab,
SsfSigRcpList sigList)
Verifies a digital signature of the given data. |
boolean |
verify(ISsfPab pab,
SsfSigRcpList sigList,
ISsfData input,
java.security.cert.X509Certificate cert)
Verifies a digital signature of the given data. |
static boolean |
verifyData(org.w3c.dom.Element sigHome,
ISsfPab pab,
SsfSigRcpList sigList,
SsfRefXMLList refList,
java.security.cert.X509Certificate cert)
Verifies a signed data element |
boolean |
writeTo(java.io.OutputStream out)
Writes the changed data to an output stream |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public SsfDataXML(java.io.InputStream in)
throws java.io.IOException,
SsfInvalidDataException
in - input stream to read the data
public SsfDataXML(org.w3c.dom.Element el)
throws SsfInvalidDataException
el - XML element to work onSsfInvalidDataException - if no XML data is supplied| Method Detail |
public boolean sign(ISsfProfile profile)
throws SsfInvalidKeyException
ISsfDatasign in interface ISsfDataISsfData.sign(com.sap.security.api.ssf.ISsfProfile)
public boolean sign(ISsfProfile profile,
java.lang.String mdAlg,
int incCerts,
boolean detached)
throws SsfInvalidKeyException,
SsfInvalidAlgException
ISsfDatasign in interface ISsfDataISsfData.sign(com.sap.security.api.ssf.ISsfProfile)
public boolean sign(SsfRefXMLList refList,
ISsfProfile profile,
int incCerts,
boolean detached)
throws SsfInvalidKeyException,
SsfInvalidAlgException
sign(Element sigHome, SsfRefXMLList refList, ISsfProfile profile,
int incCerts, boolean detached, boolean incKeyName) instead
refList - list of references to be signedprofile - containing the secret key of the signerincCerts - determine if certificates should be includeddetached - if true do not include data into signaturetrue if data could be digitally signedSsfInvalidKeyException - if invalid key is used
public boolean sign(org.w3c.dom.Element sigHome,
SsfRefXMLList refList,
ISsfProfile profile,
int incCerts,
boolean detached)
throws SsfInvalidKeyException,
SsfInvalidAlgException
sign(Element sigHome, SsfRefXMLList refList, ISsfProfile profile,
int incCerts, boolean detached, boolean incKeyName) instead
sigHome - element which will hold the signature (if null,
append signed data as last child)refList - list of references to be signedprofile - containing the secret key of the signerincCerts - determine if certificates should be includeddetached - if true do not include data into signaturetrue if data could be digitally signedSsfInvalidKeyException - if invalid key is used
public boolean sign(org.w3c.dom.Element sigHome,
SsfRefXMLList refList,
ISsfProfile profile,
int incCerts,
boolean detached,
boolean incKeyName)
throws SsfInvalidKeyException,
SsfInvalidAlgException
sigHome - element which will hold the signature (if null,
append signed data as last child)refList - list of references to be signedprofile - containing the secret key of the signerincCerts - determine if certificates should be includeddetached - if true do not include data into signatureincKeyName - if true include KeyName to KeyInfotrue if data could be digitally signedSsfInvalidKeyException - if invalid key is used
public static boolean signData(org.w3c.dom.Element sigHome,
SsfRefXMLList refList,
ISsfProfile profile,
int incCerts,
boolean incKeyName,
java.lang.String canonAlgURI)
throws SsfInvalidKeyException,
SsfInvalidAlgException
sigHome - element which will hold the signaturerefList - list of references to be signedprofile - containing the secret key of the signerincCerts - determine if certificates should be includedincKeyName - if true include KeyName to KeyInfocanonAlgURI - URI of canonicalization algorithmtrue if data could be digitally signedSsfInvalidKeyException - if invalid key is used
public boolean verify(ISsfPab pab,
SsfSigRcpList sigList)
throws SsfInvalidDataException
ISsfDataverify in interface ISsfDataISsfData.verify(com.sap.security.api.ssf.ISsfPab, com.sap.security.core.server.ssf.SsfSigRcpList)
public boolean verify(ISsfPab pab,
SsfSigRcpList sigList,
ISsfData input,
java.security.cert.X509Certificate cert)
throws SsfInvalidDataException
ISsfDataverify in interface ISsfDataISsfData.verify(com.sap.security.api.ssf.ISsfPab, com.sap.security.core.server.ssf.SsfSigRcpList)
public boolean verify(org.w3c.dom.Element sigHome,
ISsfPab pab,
SsfSigRcpList sigList,
SsfRefXMLList refList,
java.security.cert.X509Certificate cert)
throws SsfInvalidDataException
sigHome - element which holds the signature to be verifiedpab - 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 (may be null)refList - list of reference information (may be null)cert - certificate to be used for verification (if null,
use certificate included in signed data)true if signature could be verifiedSsfInvalidDataException - if given data is not digitally signed
public static boolean verifyData(org.w3c.dom.Element sigHome,
ISsfPab pab,
SsfSigRcpList sigList,
SsfRefXMLList refList,
java.security.cert.X509Certificate cert)
throws SsfInvalidDataException
sigHome - element which holds the signature to be verifiedpab - 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 (may be null)refList - list of reference information (may be null)cert - certificate to be used for verification (if null,
use certificate included in signed data)true if signature could be verifiedSsfInvalidDataException - if given data is not digitally signed
public boolean encrypt(SsfSigRcpList rcpList,
ISsfPab pab)
throws SsfInvalidKeyException
ISsfDataencrypt in interface ISsfDataISsfData.encrypt(com.sap.security.core.server.ssf.SsfSigRcpList, com.sap.security.api.ssf.ISsfPab)
public boolean encrypt(SsfSigRcpList rcpList,
ISsfPab pab,
java.lang.String symAlg)
throws SsfInvalidKeyException,
SsfInvalidAlgException
ISsfDataencrypt in interface ISsfDataISsfData.encrypt(com.sap.security.core.server.ssf.SsfSigRcpList, com.sap.security.api.ssf.ISsfPab)
public boolean encrypt(org.w3c.dom.Element keyParent,
SsfRefXMLList refList,
SsfSigRcpList rcpList,
ISsfPab pab,
java.lang.String symAlgURI)
throws SsfInvalidKeyException,
SsfInvalidAlgException
keyParent - parent element for the encrypted key (if null,
the encrypted key is child of encrypted data)refList - list of references to be encryptedrcpList - list of recipients of encrypted datapab - personal address book containing the certificate of the recipient
(if null, all certificates are considered as trusted)symAlgURI - URI of symmetric encryption algorithmtrue if data could be encrypted for all recipientsSsfInvalidKeyException - if invalid key is usedSsfInvalidAlgException - if invalid algorithm is used
public static boolean encryptKey(org.w3c.dom.Element keyParent,
java.security.Key key,
java.security.cert.X509Certificate cert,
java.lang.String id,
SsfRefXMLList refList)
keyParent - Parent element of encrypted keykey - The key to be encryptedcert - The X509 containing the public key used for encryptionid - String holding the id of the encrypted key element (or null)refList - SsfRefXMLList holding a list of data references (or null)true if encrypted key was created
public static org.w3c.dom.Element encryptData(org.w3c.dom.Element encHome,
boolean contentOnly,
java.security.Key symKey,
java.lang.String symAlgURI,
java.lang.String id)
encHome - Element to be encryptedcontentOnly - if true, encrypt content of encHome onlysymKey - Symmetric key used for encryptionsymAlgURI - URI of algorithm of symmetric keyid - String holding the id of the encrypted data element (or null)null)
public boolean decrypt(ISsfProfile profile)
throws SsfInvalidKeyException,
SsfInvalidDataException
ISsfDatadecrypt in interface ISsfDataISsfData.decrypt(com.sap.security.api.ssf.ISsfProfile)
public boolean decrypt(org.w3c.dom.Element encData,
ISsfProfile profile,
java.security.Key key)
throws SsfInvalidAlgException,
SsfInvalidKeyException,
SsfInvalidDataException
encData - The encrypted data elementprofile - containing the private key of the recipientkey - symmetric key to be used for decryption (if null,
use key included in encrypted data)true if encrypted data could be decryptedSsfInvalidAlgException - if invalid algorithm is usedSsfInvalidKeyException - if invalid key is usedSsfInvalidDataException - if given data is not encrypted
public static java.security.Key decryptKey(org.w3c.dom.Element encKey,
ISsfProfile prof,
java.lang.String symAlgURI,
java.util.ArrayList dataRefList)
throws SsfInvalidAlgException
encKey - EncryptedKey elementprof - SSF profile containing the private key used for decryptionsymAlgURI - URI of algorithm of symmetric keydataRefList - Output list of data references included (might be null)null, if decryption failed- Throws:
SsfInvalidAlgException - if invalid algorithm URI was used
public static boolean decryptData(org.w3c.dom.Element encData,
java.security.Key symKey,
java.lang.String symAlgURI)
encData - EncryptedData elementsymKey - Symmetric key used for decryptionsymAlgURI - URI of algorithm of symmetric keytrue, if decryption was successful
public boolean writeTo(java.io.OutputStream out)
throws java.io.IOException
ISsfDatawriteTo in interface ISsfDataISsfData.writeTo(java.io.OutputStream)public org.w3c.dom.Element getDataXML()
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean setCanonicalizationAlgorithm(java.lang.String canonAlgURI)
SsfRefXMLInfo.TRANS_C14N_OMIT_COMMENTScanonAlgURI - URI of canonicalization algorithmtrue if canonicalization algorithm could be setpublic java.lang.String getCanonicalizationAlgorithm()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||