Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (C) 2013-2015 Regents of the University of California.

Author(s):
Jeff Thompson <jefft0@remap.ucla.edu>
From code in ndn-cxx by Yingdi Yu <yingdi@cs.ucla.edu> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. A copy of the GNU Lesser General Public License is in the file COPYING.
 
 
 package net.named_data.jndn.security.identity;
 
 
 public abstract class PrivateKeyStorage {
  
Generate a pair of asymmetric keys.

Parameters:
keyName The name of the key pair.
params The parameters of the key.
Throws:
net.named_data.jndn.security.SecurityException
 
   public abstract void
   generateKeyPair(Name keyNameKeyParams paramsthrows SecurityException;

  
Delete a pair of asymmetric keys. If the key doesn't exist, do nothing.

Parameters:
keyName The name of the key pair.
 
   public abstract void
   deleteKeyPair(Name keyNamethrows SecurityException;

  
Get the public key

Parameters:
keyName The name of public key.
Returns:
The public key.
Throws:
net.named_data.jndn.security.SecurityException
 
   public abstract PublicKey
   getPublicKey(Name keyNamethrows SecurityException;

  
Fetch the private key for keyName and sign the data, returning a signature Blob.

Parameters:
data Pointer the input byte buffer to sign.
keyName The name of the signing key.
digestAlgorithm the digest algorithm.
Returns:
The signature Blob.
Throws:
net.named_data.jndn.security.SecurityException
 
   public abstract Blob
   sign(ByteBuffer dataName keyNameDigestAlgorithm digestAlgorithm)
       throws SecurityException;

  
Fetch the private key for keyName and sign the data using DigestAlgorithm.SHA256, returning a signature Blob.

Parameters:
data Pointer the input byte buffer to sign.
keyName The name of the signing key.
Returns:
The signature Blob.
Throws:
net.named_data.jndn.security.SecurityException
 
   public final Blob
   sign(ByteBuffer dataName keyNamethrows SecurityException
   {
     return sign(datakeyName.);
   }

  
Decrypt data.

Parameters:
keyName The name of the decrypting key.
data The byte buffer to be decrypted, from its position to its limit.
isSymmetric If true symmetric encryption is used, otherwise asymmetric encryption is used.
Returns:
The decrypted data.
Throws:
net.named_data.jndn.security.SecurityException
 
   public abstract Blob
   decrypt(Name keyNameByteBuffer databoolean isSymmetric)
          throws SecurityException;

  
Decrypt data using asymmetric encryption.

Parameters:
keyName The name of the decrypting key.
data The byte buffer to be decrypted, from its position to its limit.
Returns:
The decrypted data.
Throws:
net.named_data.jndn.security.SecurityException
  public final Blob
  decrypt(Name keyNameByteBuffer datathrows SecurityException
  {
    return decrypt(keyNamedatafalse);
  }

  
Encrypt data.

Parameters:
keyName The name of the encrypting key.
data The byte buffer to be encrypted, from its position to its limit.
isSymmetric If true symmetric encryption is used, otherwise asymmetric encryption is used.
Returns:
The encrypted data.
Throws:
net.named_data.jndn.security.SecurityException
  public abstract Blob
  encrypt(Name keyNameByteBuffer databoolean isSymmetric)
          throws SecurityException;

  
Encrypt data using asymmetric encryption.

Parameters:
keyName The name of the encrypting key.
data The byte buffer to be encrypted, from its position to its limit.
Returns:
The encrypted data.
Throws:
net.named_data.jndn.security.SecurityException
  public final Blob
  encrypt(Name keyNameByteBuffer datathrows SecurityException
  {
    return encrypt(keyNamedatafalse);
  }

  
Generate a symmetric key.

Parameters:
keyName The name of the key.
params The parameters of the key.
Throws:
net.named_data.jndn.security.SecurityException
  public abstract void
  generateKey(Name keyNameKeyParams paramsthrows SecurityException;

  
Check if a particular key exists.

Parameters:
keyName The name of the key.
keyClass The class of the key, e.g. KeyClass.PUBLIC, KeyClass.PRIVATE, or KeyClass.SYMMETRIC.
Returns:
True if the key exists, otherwise false.
  public abstract boolean
  doesKeyExist(Name keyNameKeyClass keyClassthrows SecurityException;
New to GrepCode? Check out our FAQ X