/** * Determine whether the credential is a local credential. * * A local credential will have either a private key or a secret (symmetric) key. * * @param credential the credential to evaluate * @return true if the credential has either a private or secret key, false otherwise */ protected boolean isLocalCredential(Credential credential) { return credential.getPrivateKey() != null || credential.getSecretKey() != null; }
/** * Determine whether the credential is a local credential. * * A local credential will have either a private key or a secret (symmetric) key. * * @param credential the credential to evaluate * @return true if the credential has either a private or secret key, false otherwise */ protected boolean isLocalCredential(Credential credential) { return credential.getPrivateKey() != null || credential.getSecretKey() != null; }
/** * Extract the encryption key from the credential. * * @param credential the credential containing the encryption key * @return the encryption key (either a public key or a secret (symmetric) key */ public static Key extractEncryptionKey(Credential credential) { if (credential == null) { return null; } if (credential.getPublicKey() != null) { return credential.getPublicKey(); } else { return credential.getSecretKey(); } }
/** * Extract the verification key from the credential. * * @param credential the credential containing the verification key * @return the verification key (either a public key or a secret (symmetric) key */ public static Key extractVerificationKey(Credential credential) { if (credential == null) { return null; } if (credential.getPublicKey() != null) { return credential.getPublicKey(); } else { return credential.getSecretKey(); } }
/** * Extract the signing key from the credential. * * @param credential the credential containing the signing key * @return the signing key (either a private key or a secret (symmetric) key */ public static Key extractSigningKey(Credential credential) { if (credential == null) { return null; } if (credential.getPrivateKey() != null) { return credential.getPrivateKey(); } else { return credential.getSecretKey(); } }
/** * Extract the signing key from the credential. * * @param credential the credential containing the signing key * @return the signing key (either a private key or a secret (symmetric) key */ public static Key extractSigningKey(Credential credential) { if (credential == null) { return null; } if (credential.getPrivateKey() != null) { return credential.getPrivateKey(); } else { return credential.getSecretKey(); } }
/** * Extract the verification key from the credential. * * @param credential the credential containing the verification key * @return the verification key (either a public key or a secret (symmetric) key */ public static Key extractVerificationKey(Credential credential) { if (credential == null) { return null; } if (credential.getPublicKey() != null) { return credential.getPublicKey(); } else { return credential.getSecretKey(); } }
/** * Extract the encryption key from the credential. * * @param credential the credential containing the encryption key * @return the encryption key (either a public key or a secret (symmetric) key */ public static Key extractEncryptionKey(Credential credential) { if (credential == null) { return null; } if (credential.getPublicKey() != null) { return credential.getPublicKey(); } else { return credential.getSecretKey(); } }
/** * Extract the decryption key from the credential. * * @param credential the credential containing the decryption key * @return the decryption key (either a private key or a secret (symmetric) key */ public static Key extractDecryptionKey(Credential credential) { if (credential == null) { return null; } if (credential.getPrivateKey() != null) { return credential.getPrivateKey(); } else { return credential.getSecretKey(); } }
/** * Extract the decryption key from the credential. * * @param credential the credential containing the decryption key * @return the decryption key (either a private key or a secret (symmetric) key */ public static Key extractDecryptionKey(Credential credential) { if (credential == null) { return null; } if (credential.getPrivateKey() != null) { return credential.getPrivateKey(); } else { return credential.getSecretKey(); } }
/** * Get the key contained within the credential. * * @param credential the credential containing a key * @return the key from the credential */ private Key getKey(Credential credential) { if (credential.getPublicKey() != null) { return credential.getPublicKey(); } else if (credential.getSecretKey() != null) { return credential.getSecretKey(); } else if (credential.getPrivateKey() != null) { // There should have been a corresponding public key, but just in case... return credential.getPrivateKey(); } else { return null; } }
/** * Get the key contained within the credential. * * @param credential the credential containing a key * @return the key from the credential */ private Key getKey(Credential credential) { if (credential.getPublicKey() != null) { return credential.getPublicKey(); } else if (credential.getSecretKey() != null) { return credential.getSecretKey(); } else if (credential.getPrivateKey() != null) { // There should have been a corresponding public key, but just in case... return credential.getPrivateKey(); } else { return null; } }
trustedKey = trustedCredential.getPublicKey(); } else { untrustedKey = untrustedCredential.getSecretKey(); trustedKey = trustedCredential.getSecretKey();
/** * Get the key contained within the credential. * * @param credential the credential containing a key * @return the key from the credential */ private Key getKey(Credential credential) { if (credential.getPublicKey() != null) { return credential.getPublicKey(); } else if (credential.getSecretKey() != null) { return credential.getSecretKey(); } else if (credential.getPrivateKey() != null) { // There should have been a corresponding public key, but just in case... return credential.getPrivateKey(); } else { return null; } }
/** * Get the key contained within the credential. * * @param credential the credential containing a key * @return the key from the credential */ private Key getKey(Credential credential) { if (credential.getPublicKey() != null) { return credential.getPublicKey(); } else if (credential.getSecretKey() != null) { return credential.getSecretKey(); } else if (credential.getPrivateKey() != null) { // There should have been a corresponding public key, but just in case... return credential.getPrivateKey(); } else { return null; } }
trustedKey = trustedCredential.getPublicKey(); } else { untrustedKey = untrustedCredential.getSecretKey(); trustedKey = trustedCredential.getSecretKey();
/** * Utility method to extract any key that might be present in the specified Credential. * * @param cred the Credential to evaluate * @return the Key contained in the credential, or null if it does not contain a key. */ protected Key extractKeyValue(Credential cred) { if (cred == null) { return null; } if (cred.getPublicKey() != null) { return cred.getPublicKey(); } // This could happen if key is derived, e.g. key agreement, etc if (cred.getSecretKey() != null) { return cred.getSecretKey(); } // Perhaps unlikely, but go ahead and check if (cred.getPrivateKey() != null) { return cred.getPrivateKey(); } return null; }
/** * Utility method to extract any key that might be present in the specified Credential. * * @param cred the Credential to evaluate * @return the Key contained in the credential, or null if it does not contain a key. */ protected Key extractKeyValue(Credential cred) { if (cred == null) { return null; } if (cred.getPublicKey() != null) { return cred.getPublicKey(); } // This could happen if key is derived, e.g. key agreement, etc if (cred.getSecretKey() != null) { return cred.getSecretKey(); } // Perhaps unlikely, but go ahead and check if (cred.getPrivateKey() != null) { return cred.getPrivateKey(); } return null; }
/** * Utility method to extract any key that might be present in the specified Credential. * * @param cred the Credential to evaluate * @return the Key contained in the credential, or null if it does not contain a key. */ protected Key extractKeyValue(Credential cred) { if (cred == null) { return null; } if (cred.getPublicKey() != null) { return cred.getPublicKey(); } // This could happen if key is derived, e.g. key agreement, etc if (cred.getSecretKey() != null) { return cred.getSecretKey(); } // Perhaps unlikely, but go ahead and check if (cred.getPrivateKey() != null) { return cred.getPrivateKey(); } return null; }
/** * Utility method to extract any key that might be present in the specified Credential. * * @param cred the Credential to evaluate * @return the Key contained in the credential, or null if it does not contain a key. */ protected Key extractKeyValue(Credential cred) { if (cred == null) { return null; } if (cred.getPublicKey() != null) { return cred.getPublicKey(); } // This could happen if key is derived, e.g. key agreement, etc if (cred.getSecretKey() != null) { return cred.getSecretKey(); } // Perhaps unlikely, but go ahead and check if (cred.getPrivateKey() != null) { return cred.getPrivateKey(); } return null; }